class Solution
{
public:
    bool checkAlmostEquivalent(string word1, string word2)
    {
        int count[26] = {0};
        for (char c : word1)
        {
            ++count[c - 'a'];
        }
        for (char c : word2)
        {
            --count[c - 'a'];
        }
        for (int c : count)
        {
            if (c > 3 || c < -3)
            {
                return false;
            }
        }
        return true;
    }
};